<div id="tabs">

<form class="form-horizontal" id="ae_form" action="/pg/ac_Operatore/Create" method="post" role="form">
    <fieldset>
<input type="hidden" name="id" value="{{pageData['dao'].id}}"/>
<ul>
<li><a href="#tabs-1" title="Informazioni principali ed obbligatorie">Informazioni</a></li>
<li><a href="#tabs-2" title="foto">Foto</a></li>
</ul>
<!-- TAB 1 -->
<div id="tabs-1">
    <div class="form-group" title="">
       <label class="col-sm-2 col-lg-2 control-label" for="denominazione">Username:</label>
       <div class="col-sm-5 col-lg-5">
            <input class="validate[required,{{'ajax[ajaxUserCall],' if not pageData['dao'].id}} minSize[5]] medium"  value='{{pageData["dao"].username|nonone}}' type="text" name="username" id="username"  />
        </div>
    </div>
    <span class="help-block">ATTENZIONE: Se modifichi la username devi obbligatoriamente reinserire la password</span>

    <div class="form-group" title="">
       <label class="col-sm-2 col-lg-2 control-label" for="password">Password:</label>
       <div class="col-sm-5 col-lg-5">
            <input class="validate[{{'minSize[5], required' if not pageData['dao'].id}} ] text-input medium"  type="password" name="password" id="password"  />
        </div>
    </div>

    <div class="form-group" title="">
       <label class="col-sm-2 col-lg-2 control-label" for="re-password">Re Password:</label>
       <div class="col-sm-5 col-lg-5">
            <input class="validate[{{'minSize[5], required' if not pageData['dao'].id}}, equals[password]] text-input medium"  type="password" name="re-password" id="re-password"  />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="email">Email:</label>
        <div class="col-sm-5 col-lg-5">
                <input class="validate[required,custom[email],{{'ajax[ajaxEmailOpeCall]' if not pageData['dao'].id}}] text-input"  value='{{pageData["dao"].email|nonone}}' type="text" name="email" id="email"  />
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2">
            <label class="checkbox-inline">
            <input type="checkbox" id="active" name="active"  {{ "checked" if pageData["dao"].active == True }}>
            Attivo</label>
            <label class="checkbox-inline">
            <input type="checkbox" id="privacy" name="privacy"  {{ "checked" if pageData["dao"].privacy == True }} >
            Privacy</label>
            <label class="checkbox-inline">
            <input type="checkbox" id="mailing_list" name="mailing_list"  {{ "checked" if pageData["dao"].mailing_list == True }}>
            Mailing List</label>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" >Data registrazione:</label>
        <div class="col-sm-5 col-lg-5">
            <p class="form-control-static">{{pageData["dao"].registration_date|nonone|datetimeformat}}</p>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" >Ultima modifica:</label>
        <div class="col-sm-5 col-lg-5">
            <p class="form-control-static">{{pageData["dao"].last_modified|nonone|datetimeformat}}</p>
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="cognome">Cognome:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="cognome" name="cognome" value='{{pageData["dao"].cognome|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="nome">Nome:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="nome" name="nome" value='{{pageData["dao"].nome|nonone}}' />
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="genere" >Genere</label>
        <div class="col-sm-5 col-lg-5">
            <select id="genere" name="genere" class="">
                <option value="M" {{ 'selected="selected"' if "M" == pageData["dao"].genere}}> M </option>
                <option value="F" {{ 'selected="selected"' if "F" == pageData["dao"].genere}}> F </option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="tipo_operatore" >Tipo</label>
        <div class="col-sm-5 col-lg-5">
            <select id="tipo_operatore" name="tipo_operatore" class="">
                <option value="cliente" {{ 'selected="selected"' if "cliente" == pageData["dao"].tipo_operatore}}>Cliente </option>
                <option value="amministratore" {{ 'selected="selected"' if "amministratore" == pageData["dao"].tipo_operatore}}> Amministratore </option>
                <option value="cittadino" {{ 'selected="selected"' if "cittadino" == pageData["dao"].tipo_operatore}}> Cittadino </option>
            </select>
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="data_nascita">Data di Nascita:</label>
        <div class="col-sm-2 col-lg-2">
            <input class="form-control" type="text" id="data_nascita" name="data_nascita" value='{{pageData["dao"].data_nascita|dateformat}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="cellulare">Cellulare:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="cellulare" name="cellulare" value='{{pageData["dao"].cellulare|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="f_imei">Imei:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="f_imei" name="f_imei" value='{{pageData["dao"].f_imei|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="f_idreg">IdReg:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="f_idreg" name="f_idreg" value='{{pageData["dao"].f_idreg|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="ean13">Codici Grafici:</label>
        <div class="col-sm-5 col-lg-5">
            <img src="data:image/png;base64,{{pageData['dao'].f_ean}}" alt="nome immagine"/><br/>
            <img src="data:image/png;base64,{{pageData['dao'].f_qrcode}}" alt="non presente"/>
        </div>
    </div>
</div>
<!-- fine TAB 1 -->
<!-- TAB2 -->
<div id="tabs-2">
    <p>Qui ci va il caricamento e la visualizzazione di una eventuale foto....</p>
</div>
</fieldset>
<div class="form-group" title="Bottoni di salvataggio e reset del form">
        <div class="col-sm-5 col-lg-5 col-sm-offset-2">
            <input class="btn btn-default" type="submit" value="Salva" name="add"/>
            <input class="btn btn-default" type="button" value="Chiudi" name="chiudi" id="chiudi_edit"/>
        </div>
    </div>

</form>
</div>
<script>
  $(document).ready(function(){

$( "#ae_form" ).validationEngine({
                    prettySelect : true,
                    useSuffix: "_chosen",
                });
$( "#id_role" ).chosen({
                    disable_search:true,
                    allow_single_deselect: true})

$( "#tabs" ).tabs();
$("#data_nascita").datepicker({ changeMonth: true, changeYear: true, dateFormat:"dd/mm/yy",});
$("#data_nascita").datepicker( $.datepicker.regional[ "it" ] );
});

</script>
